from django.urls import path
from rest_framework.routers import SimpleRouter
from cost.views import UserView, AccountView, DetailView, get_local_map

from cost.views import check_code, get_version_info, show_local, change_local, get_tel_code, show_weather, get_code_img

# 获取路由对象
router = SimpleRouter()
# 使用router注册地址，注册一个user资源,自动生成了一些接口地址
# UserView为处理函数类，注册的url会自动在后面补上一个 /
router.register('user', UserView)
router.register('account', AccountView)
router.register('detail', DetailView)

urlpatterns = [
    path('check_code/', check_code),
    path('get_version_info/', get_version_info),
    path('show_local/', show_local),
    path('change_local/', change_local),
    path('get_tel_code/', get_tel_code),
    path('show_weather/', show_weather),
    path('get_code_img/', get_code_img),
    path('get_local_map/', get_local_map),
]

# 将生成的接口地址加到django能理解的urlpatterns变量上
urlpatterns += router.urls